$(function(){
	
	$("#form").validate({
		rules: {
			name: {
				required: true,
				minlength: 3
			},
			prenom: {
				required: true,
				minlength: 3
			},
			product: {
				required: true,	
			},			
			adress: {
				minlength: 10
			},
			code: {
				number: true,
				minlength: 6
			},
			ville: {
				minlength: 10
			},
			email: {
				required: true,
				email: true
			},
			phone: {
				required: true,
				number: true,
				minlength: 6
			},
			/*fax: {
				required: true,
				number: true,
				minlength: 12
			},*/
			message: {
				required: true
			}
		},
		messages: {			
			name: {
				required: 'Ce champ est obligatoire',
				minlength: 'Longueur minimale: 3'
			},
			prenom: {
				required: 'Ce champ est obligatoire',
				minlength: 'Longueur minimale: 3'
			},
			product: {
				required: 'Ce champ est obligatoire'
			},
			adress: {
				minlength: 'Longueur minimale: 10'
			},
			code: {
				number: 'Numéro de code incorrect',
				minlength: 'Longueur minimale: 6'
			},
			ville: {
				number: 'Invalid ville',
				minlength: 'Longueur minimale: 10'
			},
			emile: {
				required: 'Ce champ est obligatoire',
				email: 'Invalid adresse e-mail',
			},
			phone: {
				required: 'Ce champ est obligatoire',
				number: 'Invalid ville',
			},
			/*fax: {
				required: 'Ce champ est obligatoire',
				number: 'Numéro de fax valide',
				minlength: 'Longueur minimale: 12'
			},*/
			message: {
				required: 'Ce champ est obligatoire'
			}
		},
		success: function(label) {
			label.html('OK').removeClass('error').addClass('ok');
			setTimeout(function(){
				label.fadeOut(500);
			}, 2000)
		}
	});
	
});